<?php
/*
RSSClass. Script que permite sindicar contenido usando el standard RSS 2.0
*/
class rss{
     //Variables $title, $link y $description son necesarias del canal
     var $title='', $link='', $description='',$category='', $items;

     function cargar_rss(){
          header('Content-type: text/xml; charset=iso-8859-1');
          echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
          echo "<rss version=\"2.0\">\n";
          echo "    <channel>\n";
          echo "         <title>" . $this->title . "</title>\n";
          echo "         <link>" . $this->link . "</link>\n";
          echo "         <description>" . $this->description . "</description>\n\n";
          $this->cargar_items();
          echo "    </channel>\n";
          echo "</rss>";
     }
     function cargar_items(){
          $NumItems=count($this->items)-1;
          $i=0;
          for($i=0;$i<=$NumItems;$i++){
               echo "<item>\n";
               echo "    <title>" . $this->items[$i]['title'] . "</title>\n";
               echo "    <link>" . $this->items[$i]['link'] . "</link>\n";
               echo "    <description>" . $this->items[$i]['description'] . "</description>\n";
               echo "    <category>" . $this->items[$i]['category'] . "</category>\n";
               echo "    <pubDate>" . $this->items[$i]['pubDate'] . "</pubDate>\n";
               echo "</item>";
          }
     }

}
?>